home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / utils / file / managers / mc-3.2 / mc-3 / mc-3.2.1 / doc / DEVEL next >
Encoding:
Text File  |  1996-05-17  |  4.2 KB  |  124 lines

  1. -*-outline-*-
  2.  
  3. This is the developers hint guide.
  4. Some parts are based on mail messages.
  5.  
  6. Please feel free to add your name to this list:
  7. by Miguel de Icaza
  8.  
  9. * Working with the Midnight Commander
  10.  
  11.    If you plan on working on the Midnight Commander, here are some
  12.    tips on how to make your development easier and my job of merging
  13.    your code easier, I find them useful.
  14.  
  15. o  Run make depend if you modify the source code structure (e.g. you
  16.    add/remove include files).  This is very important, it will help you
  17.    to get an accurate compilation.
  18.  
  19. o  It's recommended that you use GNU Make (if you want to use the
  20.    depend feature).
  21.  
  22. o  I work with the tags feature of GNU emacs.  Run the make tags
  23.    command to get an updated TAGS file.  The command Alt-. will take
  24.    you to any function or variable definition.
  25.  
  26. o  Try to keep the indenting style as it's currently.  Normally if you
  27.    just created a new file with a different coding style, run the GNU
  28.    indent program on it (remember to make a backup copy first) like
  29.    this: indent -kr -pcs filename.c
  30.  
  31. o  This code is distributed under the GNU General Public License and
  32.    Keep this in mind when adding code to the program.
  33.  
  34. * Code structure.
  35.  
  36.    The program uses extensively the dialog manager written by Radek
  37.    Doulik.  To understand how the dialog manager works, please read
  38.    the dlg.c and dlg.h.  You will find the basic widgets in the file
  39.    widget.c and the widget.h file.  If you understand this two files,
  40.    you are done.  The files option.c and boxes.c contain some examples
  41.    of how the dialog manager functions are used.  For a more complete
  42.    example, take a look at the main.c file.
  43.  
  44.    Take a look at the FILES file in the doc/ directory.  It has a
  45.    roadmap of the files that make up the Midnight Commander.
  46.  
  47.    The file util.c has a lot of utility functions, get familiar with
  48.    them, they are very simple. 
  49.  
  50.    The code has almost no hardcoded limits, there are a lot of ways of
  51.    avoiding them.  For example, when you want to concatenate strings,
  52.    use the copy_strings functions, it is used like this:
  53.  
  54.     new_text = copy_strings (username, " ", password, NULL);
  55.  
  56.    This mallocs the required area, so it still needs to be freed.
  57.  
  58. * Upcoming changes.
  59.  
  60. * Panels
  61.  
  62. * Input handling
  63.  
  64. The routines for input handling on the Midnight Commander are:
  65. xgetch, get_key_code, mi_getch and get_event.
  66.  
  67. xgetch is an interface to the low level system input mechanism.  It
  68. does not deal with the mouse.  
  69.  
  70.     In the case of curses, this is a macro that translates to getch, on
  71.     BSD curses, it is an interface to x_getch.  This routine on curses
  72.     translates key sequences to key codes (\E[A to something like
  73.     KEY_UP or whatever).
  74.  
  75.     In the case of slang there is no such conversion, that's why we
  76.     load a set of extra definition.
  77.  
  78. The get_key_code routine converts the data from xgetch to the
  79. constants the Midnight Commander uses. 
  80.  
  81.     In the case of slang, it will actually do all the job that getch
  82.     does for curses.  In the case of curses it patches a couple of
  83.     sequences that are not available on some terminal databases.  This
  84.     routine is the one you want to use if you want a character without
  85.     the mouse support.
  86.  
  87. get_event is the routine you want to use if you want to handle mouse
  88. events, it will return 0 on a mouse event, ERR if no input is
  89. available or a key code if there is some input available.  This
  90. routine in turn uses get_key_code to decode the input stream and
  91. convert it to usefull constants.
  92.  
  93. mi_getch is just a wrapper around get_event that ignores all the mouse
  94. events, it's used only in a couple of places, this routine may return
  95. ERR if no input is available (if you have set the nodelay option of
  96. curses or slang with nodelay) or a character code if no such option is
  97. available. 
  98.  
  99. * Mouse support.
  100.  
  101. The mouse support in the Midnight Commander is based on the get_event
  102. routine.  The core of the mouse event dispatching is on the
  103. dlg.c:run_dlg routine.
  104.  
  105. * ncurses
  106.  
  107. We are dropping it in favor of slang, but we will still support it, we
  108. basically are using a small subset of ncurses because we want to be
  109. compatible with Slang.
  110.  
  111.  
  112. * The Dialog manager and the Widgets
  113.  
  114. ** Button widget
  115.  
  116. ** Check box widget
  117.  
  118. ** Radio widget
  119.  
  120. ** Input widget
  121.  
  122. ** Listbox widget
  123.  
  124.